﻿using System.Configuration;

using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.Configuration;

namespace BudgetRight.Common
{
    public static class UnityHelper
    {
        private static IUnityContainer _container;

        public static IUnityContainer Container
        {
            get
            {
                if (_container == null)
                {
                    _container = new UnityContainer();

                    UnityConfigurationSection section = (UnityConfigurationSection)ConfigurationManager.GetSection("unity");

                    section.Containers["BudgetRightContainer"].Configure(_container);
                }

                return _container;
            }
        }
    }
}
